//app.js
App({
    onLaunch: function () {
      wx.hideTabBar();
        //调用API从本地缓存中获取数据
        /*    var logs = wx.getStorageSync('logs') || []
            logs.unshift(Date.now())
            wx.setStorageSync('logs', logs)*/
        //启动时执行的初始化工作 全局只触发一次
        //存储当前经纬度地址到本地
        // wx.getLocation({
        //     type: 'wgs84',
        //     success: function (res) {
        //         wx.setStorageSync("longitude", res.longitude);//经度
        //         wx.setStorageSync("latitude", res.latitude);//纬度
        //     }
        // })
    },
    onShow: function () {
      //隐藏系统tabbar
      //wx.hideTabBar();
    },
    getSystemInfo: function () {
      let t = this;
      wx.getSystemInfo({
        success: function (res) {
          t.globalData.systemInfo = res;
        }
      });
    },
    editTabbar: function () {
     let teamPartnerStatus =  wx.getStorageSync("teamPartnerStatus")
     console.log(teamPartnerStatus,"teamPartnerStatus")
     let tabbar = {}
     if (teamPartnerStatus == 1) {
       tabbar = {
            "backgroundColor": "#ffffff",
            "color": "#999999",
            "selectedColor": "#585CF7",
            "list": [
              {
                "pagePath": "/pages/index/index",
                "iconPath": "/images/index/djsy3.png",
                "selectedIconPath": "/images/index/sy3.png",
                "text": "首页"
              },
              {
                "pagePath": "/pages/news/news",
                "iconPath": "/images/index/sj3.png",
                "selectedIconPath": "/images/index/djsj3.png",
                "text": "待审批"
              },
              {
                "pagePath": "/pages/partner/partner",
                "iconPath": "/images/index/hhr3.png",
                "selectedIconPath": "/images/index/djhhr3.png",
                "text": "合伙人",
				        // "isSpecial": true,
              },
              {
                "pagePath": "/pages/wallet/wallet",
                "iconPath": "/images/index/dd3.png",
                "selectedIconPath": "/images/index/djdd3.png",
                "text": "订单"
              },
              {
                "pagePath": "/pages/referenceprice/referenceprice",
                "iconPath": "/images/index/qb3.png",
                "selectedIconPath": "/images/index/djqb3.png",
                "text": "钱包"
              }
            ]
          };
        } else {
           tabbar = {
            "backgroundColor": "#ffffff",
            "color": "#999999",
            "selectedColor": "#585CF7",
            "list": [
              {
                "pagePath": "/pages/index/index",
                "iconPath": "/images/index/djsy3.png",
                "selectedIconPath": "/images/index/sy3.png",
                "text": "首页"
              },
              {
                "pagePath": "/pages/news/news",
                "iconPath": "/images/index/sj3.png",
                "selectedIconPath": "/images/index/djsj3.png",
                "text": "待审批"
              },
              {
                "pagePath": "/pages/partner/partner",
                "iconPath": "/images/index/hhr3.png",
                "selectedIconPath": "/images/index/djhhr3.png",
                "text": "经纪人",
				        // "isSpecial": true,
              },
              {
                "pagePath": "/pages/wallet/wallet",
                "iconPath": "/images/index/dd3.png",
                "selectedIconPath": "/images/index/djdd3.png",
                "text": "订单"
              },
              {
                "pagePath": "/pages/referenceprice/referenceprice",
                "iconPath": "/images/index/qb3.png",
                "selectedIconPath": "/images/index/djqb3.png",
                "text": "钱包"
              }
            ]
          }; 
        }
      let currentPages = getCurrentPages();
      let that = currentPages[currentPages.length - 1];
      let pagePath = that.route;
	  // console.log('-----')
      (pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);
      for (let i in tabbar.list) {
        tabbar.list[i].selected = false;
        (tabbar.list[i].pagePath == pagePath) && (tabbar.list[i].selected = true);
      }
      that.setData({
        tabbar: tabbar
      });
    },
    getUserInfo: function (cb) {
        /*    var that = this
            if (this.globalData.userInfo) {
              typeof cb == "function" && cb(this.globalData.userInfo)
            } else {
              //调用登录接口
              wx.getUserInfo({
                withCredentials: false,
                success: function(res) {
                  that.globalData.userInfo = res.userInfo
                  typeof cb == "function" && cb(that.globalData.userInfo) 
                }
              })
            }*/
    },
    globalData: {
      // http://192.168.0.131:9001
      // https://yun.xssbdc.com/api
      // http://192.168.0.135/api
      // http://172.27.252.222:9001
      // http://192.168.0.119:9001
        api: "https://yun.xssbdc.com/api",//接口服务地址
        imgUrl: "http://f.boolv.com",//图片服务地址 
        mobApi: "https://s.boolv.com",//手机服务地址 
        gaoDeKey: '972cafdc2472d8f 779c5274db770ac22',//高德web API服务key
        version: '1.0.18', //当前版本号
        tabbar: {
            "backgroundColor": "#ffffff",
            "color": "#979795",
            "selectedColor": "#1c1c1b",
            "list": [
              {
                "pagePath": "pages/index/index",
                "iconPath": "images/index/djsy3.png",
                "selectedIconPath": "images/index/sy3.png",
                "text": "首页"
              },
              {
                "pagePath": "pages/news/news",
                "iconPath": "images/index/sj3.png",
                "selectedIconPath": "images/index/djsj3.png",
                "text": "待审批"
              },
              {
                "pagePath": "pages/partner/partner",
                "iconPath": "images/index/hhr3.png",
                "selectedIconPath": "images/index/djhhr3.png",
                "text": "合伙人",
              },
              {
                "pagePath": "pages/wallet/wallet",
                "iconPath": "images/index/dd3.png",
                "selectedIconPath": "images/index/djdd3.png",
                "text": "订单"
              },
              {
                "pagePath": "pages/referenceprice/referenceprice",
                "iconPath": "images/index/qb3.png",
                "selectedIconPath": "images/index/djqb3.png",
                "text": "钱包"
              }
            ]
          }
    }
})